package com.socket;

import java.io.ObjectInputStream;
import java.net.ServerSocket;
import java.net.Socket;

public class Server {
	public static void main(String[] args) {
		try {
			ServerSocket server = null;
			while (true) {
				if (server == null)
					server = new ServerSocket(9995);
				Socket client = server.accept();
				ObjectInputStream in = new ObjectInputStream(client.getInputStream());
				String str = in.readUTF();
				System.out.println("str---" + str);
				
//				Random r = new Random();
//				out.writeUTF("hello world " + r.nextInt());
				// DataModel dm = new DataModel();
				// dm.setCurData(FileUtil.getCurData());
				// dm.setCurList(FileUtil.getCurList());
				// out.writeObject(dm);

			}
			
		} catch (Exception e) {
			e.printStackTrace() ;
		}
	}
}
